<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <div id="message">尚未收到消息</div>

    <script src="../../js/jquery-3.2.1.js"></script>
    <script>
        window.addEventListener('message', function (event) {
            if(event.origin !== 'http://127.0.0.1:8080') return;  //为了保证安全性，判断消息来源
            $('#message').text(event.data)
        }, false);
    </script>
</body>

</html>